from html import *

class Site:
    RegisterTemplate('site/base/page.html',
                     DOCTYPE() + HTML(HEAD(TITLE(Block('page_title')),
                                           ExternalStylesheet('/style.css')),
                                      BODY(DIV(Block('page_detail'),
                                               id = 'container'))))

    class Page:
        Base = Child.Model('site/base/page.html')
        Title = Block.Model('page_title')
        Detail = Block.Model('page_detail')

        class Article:
            Title = Variable.Name.article.title
            Content = Variable.Name.article.content

        Content = TABLE.Model(TR.Model(TD.Model(Article.Title, className = 'caption'),
                                       TD.Model(Article.Content, className = 'article')))

        Prototype = Base.Model(Title.Model(Article.Title, ' | Site'),
                               Detail.Model(Content))

        @classmethod
        def View(self, request = None, **values):
            return prettify(render(self.Prototype(), **values))

print Site.Page.View(article = dict(title = 'Article #1',
                                    content = 'A bit of content.'))
